


function load(id)
{
    var datos = {
        empresa_id: id
    };
    $.ajax({
        url:"http://localhost/srbus/ajax/mostrar_dire/",
        type: 'POST',
        data: datos,
        success: function(msg){
            var array = msg.split("_");
            direccion = array[0];
            fijo=array[1];
            celular = array[2];
                    
            if($('#div_'+id).css('display')=='block')
            {
                $('#div_'+id).css('display', 'none');
            }
            else
            {
                        
                $('#div_'+id).css('display', 'block');
                $('#direccion_'+id).text('Dirección: '+direccion);
                $('#fijo_'+id).text('Fijo/s: '+fijo);
                $('#celular_'+id).text('Celular/es: '+celular);
                        
                //Solo muestra lo que tenga info, si no exite la info no lo muestra
                if(direccion!="")
                    $('#direccion_'+id).css('display', 'block');
                if(fijo!="")
                    $('#fijo_'+id).css('display', 'block');
                if(celular!="")
                    $('#celular_'+id).css('display', 'block');
            }
                    
        }
    });
            

    base_url=$('#base_url').val();

    $('.load_more').live("click",function() {//If user clicks on hyperlink with class name = load_more
        var last_msg_id = $(this).attr("id");
        //Get the id of this hyperlink 
        //this id indicate the row id in the database 
        if(last_msg_id!='end'){
            //if  the hyperlink id is not equal to "end"
            $.ajax({//Make the Ajax Request
                type: "POST",
                url: base_url+"ajax_pag/more_pag/",
                data: "lastmsg="+ last_msg_id, 
                beforeSend:  function() {
                    $('a.load_more').html('<img src="loading.gif" />');//Loading image during the Ajax Request
  
                },
                success: function(html){//html = the server response html code
                    $("#more").remove();//Remove the div with id=more 
                    $("ul#updates").append(html);//Append the html returned by the server .
                }
            });
  
        }
        return false;
    });
    
}